﻿using System;
using System.Collections.Generic;

namespace Sonce.Editor
{
	/// <summary>
	/// Class that handles Undo and Redo commands.
	/// </summary>
	public partial class UndoManager
	{
		public enum UndoChangeTypes
		{
			ElementAdded,
			ElementDeleted,
			PropertyChanged
		}

		public class UndoState : IUndoState
		{
			public int OldValue;
			public int NewValue;
		}

		private List<UndoState> history;
		private int currentIndex = 0;

		public UndoManager()
		{
		}

		public void Add()
		{
		}

		public void Add(UndoState state)
		{
		}

		public void Add(string oldValue, string newValue, string type)
		{
			//element change (add, delete), property change, order change (move to front, move to back)
			//see property changed event args (e.g. TreeView.SelectedItemChanged)
		}

		public void Clear()
		{
		}

		private void applyState(UndoState state)
		{
			//TODO: Return to the defined state
		}

		public void Undo()
		{
			UndoState state = this.history[this.currentIndex--];
			applyState(state);
		}

		public void Redo()
		{
		}

		public event EventHandler StateChanged;
	}
}
